<template>
	<div class="jokenews  pb3">
		<div class="joke-nav clearfix pl3 pr3 pt3 pb3 bg-fff">
			<span class="tabtype tc" v-bind:class="{'curr':showtype}" v-on:click="showymxh">幽默笑话</span>
			<span class="tabtype tc" v-bind:class="{'curr':!showtype}" v-on:click="showwlt">无厘头</span>
		</div>
		<div class="bg-fff jokenews-box pt5 pb5 mb5 mt5" v-for="(o,index) in jokedata" v-bind:item="o" v-bind:index="index" v-if="showtype">
			<h1 class="j-title pb2 pl3 pr3 tc"><a href="javascript:void(0)">{{ o.title }}</a></h1>
			<p class="j-tytime tc mt3 pl3 pr3">
				<span class="j-type">幽默笑话</span>
				<span class="j-time">来源：来福网</span>
			</p>
			<div class="j-photo mt5 tc">
				<a href="javascript:void(0)"><img :src="o.thumburl"></a>
			</div>
		</div>
		
		<div class="bg-fff jokewlt-box pt5 pb5 mb5 mt5" v-for="(w,index) in wltdata" v-bind:item="w" v-bind:index="index" v-else>
			<h1 class="wlt-title pb2 pl3 pr3"><a :href="w.url">{{ w.title }}</a></h1>
			<p class="j-tytime mt3 pl3 pr3">
				<span class="j-time">来源：来福网</span>
				<span class="j-type">无厘头</span>
			</p>
			<div class="wlt-content pl3 pr3 mt5">
				{{ w.content }}
			</div>
		</div>
	</div>
</template>

<script>
	import axios from 'axios';
	export default{
		data(){
			return{
				jokedata:[],
				wltdata:[],
				showtype:true
			}
		},
		mounted: function(){
			let url = '/api/107-33';
			let sign = 'FD23B802A29A46D14CE759F93EAC3125';
			axios({
				method: 'post',
				url:url,
				params: {
					'showapi_appid':'54164',
			    	'showapi_sign':sign
				}
			}).then((res)=>{
				console.log(res.data.showapi_res_body.list)
				this.jokedata = res.data.showapi_res_body.list
			})
		},
		methods: {
			showymxh(){
				this.showtype = true
				let url = '/api/107-33';
				let sign = 'FD23B802A29A46D14CE759F93EAC3125';
				axios({
					method: 'post',
					url:url,
					params: {
						'showapi_appid':'54164',
				    	'showapi_sign':sign
					}
				}).then((res)=>{
					console.log(res.data.showapi_res_body.list)
					this.jokedata = res.data.showapi_res_body.list
				})
			},
			showwlt(){
				this.showtype = false
				let url = '/api/107-32';
				let sign = 'FD23B802A29A46D14CE759F93EAC3125';
				axios({
					method: 'post',
					url:url,
					params: {
						'showapi_appid':'54164',
				    	'showapi_sign':sign
					}
				}).then((res)=>{
					console.log(res.data.showapi_res_body.list)
					this.wltdata = res.data.showapi_res_body.list
				})
			}
		}
	}
</script>

<style>
	
</style>